home *** CD-ROM | disk | FTP | other *** search
/ Aminet 39 / Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso / Aminet / game / shoot / Orbit_src.lha / Orbit / source / joystick_amiga.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-07-04  |  935 b   |  42 lines

  1. /*
  2.     Amiga Joystick and Joypad support for ORBIT
  3.  
  4.     29.04.2000 - written, tested, worked :)
  5.     30.04.2000 - added diagonal movement,
  6.                  pitch roll for joypad,
  7.                  fire while moving
  8. */
  9.  
  10. #include "orbit.h"
  11.  
  12. LucyPlayJoystick *lucy_joy = NULL;
  13.  
  14. void InitJoy()
  15. {
  16.   if (lucy_joy = lucJoyInit())
  17.     joy_available = 1;
  18.   else
  19.     joy_available = 0;
  20. }
  21.  
  22. void JoyStick()
  23. {
  24.   /* Ignore joystick motion if dead */
  25.   if ((state == STATE_DEAD1) || (state == STATE_DEAD2)) return;
  26.  
  27.   lucJoyRead(lucy_joy);
  28.  
  29.   if (lucy_joy->Red)      PlayerFires();
  30.   if (lucy_joy->Up)       player.move_up = 0.5;
  31.   if (lucy_joy->Down)     player.move_down = 0.5;
  32.   if (lucy_joy->Left)     player.move_left = 0.5;
  33.   if (lucy_joy->Right)    player.move_right = 0.5;
  34.   if (lucy_joy->Forward)  player.move_pitchright = 1.0;
  35.   if (lucy_joy->Reverse)  player.move_pitchleft = 1.0;
  36. }
  37.  
  38. void FreeJoy()
  39. {
  40.   if (lucy_joy) lucJoyKill(lucy_joy);
  41. }
  42.